﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication9
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {

            label3.Enabled = true;
            textBox1.Enabled = true;
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            label3.Enabled = false;
            textBox1.Enabled = false;
        }
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (radioButton1.Checked = true)
            {
                label3.Enabled = true;
                textBox1.Enabled = true;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            double nfreatico;
            double capa1;
            double capa2;
            double capa3;
            double capa4;
            double capa5;
            try
            {
                nfreatico = Convert.ToDouble(textBox1.Text);

            }
            catch (Exception exc1)
            {
                MessageBox.Show("La dimensión introducida para el nivel freático no es válida");
            }



            try
            {
                capa1 = Convert.ToDouble(textBox1.Text);

            }
            catch (Exception exc1)
            {
                MessageBox.Show("La dimensión introducida para la Capa 1 no es válida");
            }


            try
            {
                capa2 = Convert.ToDouble(textBox1.Text);

            }
            catch (Exception exc1)
            {
                MessageBox.Show("La dimensión introducida para la Capa 2 no es válida");
            }




        }
        static int constante (int i)
        {
            return i;

        }
      private void button_añadirc_Click(object sender, EventArgs e)
        {
            
            if (labelcapa2.Visible == true)
            {
                if (labelcapa3.Visible == true)
                {
                    if (labelcapa4.Visible == true)
                    {
                        if (labelcapa5.Visible == true)
                        {
                            MessageBox.Show("No se pueden añadir más capas");
                        }
                        else
                        {
                            labelcapa5.Visible = true;
                            textBoxcapa5.Visible = true;
                            grafterreno5.Visible = true;
                        }
                    }
                    else
                    {
                        labelcapa4.Visible = true;
                        textBoxcapa4.Visible = true;
                        grafterreno4.Visible = true;
                    }
                }
                else
                {
                    labelcapa3.Visible = true;
                    textBoxcapa3.Visible = true;
                    grafterreno3.Visible = true;
                    
                }
            }
            else
            {
                labelcapa2.Visible = true;
                textBoxcapa2.Visible = true;
                grafterreno2.Visible = true;
            }
        }

        private void button_eliminarc_Click(object sender, EventArgs e)
        {

        }

        public void labelcapa2_Click(object sender, EventArgs e)
        {
            
        }
    }
    }
        
    
